<template>
  <!-- 抄表机抄表 -->
  <div class="flManualReading">
    <!-- 搜索框-->
    <div style="padding: 0px 0px;">
      <!--      <div style="font-weight:700;padding:10px 10px 10px 50px;">抄表机抄表</div>-->
      <!--      <div style="border-top:1px solid #E6E6E6;margin:0px 20px;"></div>-->
      <searchComponentsCss :searchData="searchData" :optionsZi="optionsZi" :searchOptionTable="searchOptionTable" @searchCallBack="searchCallBack" :shrinkBoxOpenClose='shrinkBoxOpenClose'></searchComponentsCss>
      <!-- 收缩框 -->
      <!-- {{numSearch}} -->
      <div class="shrinkBox" @click="shrinkBoxOpenClose = !shrinkBoxOpenClose">
        <i :class="shrinkBoxOpenClose?'el-icon-arrow-up':'el-icon-arrow-down'" v-if="numSearch>8"></i>
      </div>
      <div style="border-top:1px solid #E6E6E6;margin:0 30px;"></div>
      <!-- 引用插件   试一试 -->
      <!-- <div style="height: 0px">
        <object id="JBOcx" classid='ActiveX.cab'
        CODEBASE="./compotents/"></object>
        <object id="csharpActiveX" codebase="./compotents/"
        classid="JXActivex.cab"></object>
        </div>-->
      <div style="height: 0px">
        <object id="JBOcx" classid="clsid:50906411-79AA-4B36-9C57-FB94F5BA1D08" codebase="./compotents/ActiveX.cab##FileVersion=1,0,0,1"></object>
        <object id="csharpActiveX" codebase="./compotents/JXActivex.cab#version=1,0,2,0" classid="clsid:7BA7D60D-0305-4318-8466-9A0DC31964A9"></object>
      </div>
      <!-- <div style="height: 0px">
        <object id="JBOcx" classid='clsid:50906411-79AA-4B36-9C57-FB94F5BA1D08'
        CODEBASE="<%=basePath%>/plug-in/ActiveX/ActiveX.cab##FileVersion=1,0,0,1"></object>
        <object id="csharpActiveX" codebase="<%=basePath%>/plug-in/Activex/JXActivex.cab#version=1,0,2,0"
        classid="clsid:7BA7D60D-0305-4318-8466-9A0DC31964A9"></object>
      </div>-->
      <div class="right_row" style="padding:25px 30px;display:flex;justify-content: space-between;">
        <div class="btn-groups">
          <div class="moreBtnClassDefault" id="btnGroups" :class="{'moreBtnClass':moreBtnUp}">

            <!-- 检测插件 -->
            <el-button type="primary" v-if="but_jccbj" plain size="mini" icon="el-icon-search" @click="CheckActiveX">检测插件</el-button>
            <!-- 检测抄表机 -->
            <el-button type="primary" plain size="mini" icon="el-icon-search" v-if="but_jccbj" @click="CheckCbj('检测抄表机')">检测抄表机</el-button>
            <!-- 下发凭证通抄表档案 -->
            <el-button type="primary" plain size="mini" icon="el-icon-download" v-if="but_scxfpzt" @click="DownLoadFile('下发平政通抄表档案')">下发平政通抄表档案</el-button>
            <!-- 上传凭证通抄表档案 -->
            <el-button type="primary" plain size="mini" icon="el-icon-upload2" v-if="but_scxfpzt" @click="UploadFile('上传平政通抄表档案')">上传平政通抄表档案</el-button>
            <!-- 检测捷先抄表机 -->

            <el-button type="primary" plain size="mini" v-if="but_jcjxcbj" icon="el-icon-search" @click="CheckCbj('检测捷先抄表机')">检测捷先抄表机</el-button>
            <!-- 下发捷先抄表档案 -->
            <el-button type="primary" plain size="mini" v-if="but_scxfjx" icon="el-icon-download" @click="DownLoadFile('下发捷先抄表档案')">下发捷先抄表档案</el-button>
            <!-- 上传捷先抄表档案 -->
            <el-button type="primary" plain size="mini" icon="el-icon-upload2" v-if="but_scxfjx" @click="UploadFile('上传捷先抄表档案')">上传捷先抄表档案</el-button>
            <!-- 下发三川抄表档案 -->
            <el-button type="primary" plain size="mini" icon="el-icon-download" v-if="but_scxfsc" @click="DownLoadFile('下发三川抄表档案')">下发三川抄表档案</el-button>
            <!-- 上传三川抄表档案 -->
            <el-button type="primary" plain size="mini" icon="el-icon-upload2" v-if="but_scxfsc" @click="UploadFile('上传三川抄表档案')">上传三川抄表档案</el-button>
            <derivedTbale class="importX" :suoS="suoS" :multipleSelection="multipleSelection" v-if="but_export" />

          </div>

          <div v-if="btnShow" class="btnMoreClass" @click="btnMore"><i :class="{'el-icon-arrow-down':moreBtnDown,'el-icon-arrow-up':moreBtnUp}"></i><span></span></div>
        </div>
        <!-- 右侧搜索组件 -->
        <rightButtons class="rightButtons" style="float:right;padding:0;" :btn-switch-configuration="true" :configurationData="searchData" @sunS_F="sunS_F" v-if="but_pz" @emptySearch="emptySearch" @configuration="configuration" @goFatherComponent="goFatherComponent"></rightButtons>
        <!-- padding: 25px 30px; -->
        <!-- 导入导出 -->
        <!-- 无下载模板      回删 -->
        <!-- 模板导入导出下载 -->

        <!-- -------------------- -->
        <!-- <div class="buttons" style="float:right;padding:10px;"> -->
        <!-- <el-button
            type="primary"
            size="mini"
            plain
            @click="sunS_F"
            icon="el-icon-search"
        >搜索</el-button>-->
        <!-- </div> -->
      </div>
    </div>
    <div class="out">
      <!--数据列表-->
      <!-- 字典 -->
      <!-- {{dataAttribute}} -->
      <dictionaries :searchData="searchData" :modelType="modelType" @optionData="dictionariesCallBack"></dictionaries>
      <el-table ref="multipleTable" :data="dataAttribute" v-loading.body="loading" border fit max-height="511px" highlight-current-row size="mini" :cell-style="{padding:'5px 0'}" @selection-change="handleSelectionChange" @sort-change="sortChangeTable">
        <el-table-column align="center" type="selection" :show-overflow-tooltip="true" width="45"></el-table-column>
        <el-table-column align="center" label="序号" :index="indexMethod" type="index" width="54px"></el-table-column>
        <!-- 数据列遍历 -->
        <el-table-column align="center" v-for="(item,index) in searchData" v-if="item.tableSign&&item['configurationSign']" :key="index" :label="item.CN" :prop="item.EN" :show-overflow-tooltip="true" :sortable='customMethod(item)' min-width="140px">
          <template slot-scope="scope">
            <div v-if='!but_cb'>{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</div>
            <div v-else>
              <div v-if="item.EN === 'readingValue' &&scope.row.cbStatus === 1 || item.EN === 'readingValue'&& scope.row.cbStatus === 0" class="thisReading" @click="okl(scope.$index,scope.row)" style="height:47px;line-height:47px;">
                <el-input v-if="scope.$index === currentId" v-focus v-model="scope.row[item.EN]" size="mini" @blur="inputBlur(scope.$index,scope.row[item.EN],scope.row.id,scope.row)" @keyup.enter.native="inputFoucs(scope.$index,scope.row[item.EN],scope.row.id,scope.row)">
                  <!-- @change="handleEdit(scope.$index,scope.row)" -->
                  <!-- @keyup.enter.native="inputFoucs(scope.$index,scope.row[item.EN],item.id)" -->
                  <!-- v-model="scope.row.readingValue" -->
                </el-input>
                <span v-else>{{scope.row[item.EN]}}</span>
              </div>
              <span v-else-if="item.EN ==='cbStatus'">
                <!-- 0未抄 1已抄 2已审核 3已结束 -->
                <span v-if="scope.row[item.EN] == 0" style="color:#666666;">{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span>
                <span v-if="scope.row[item.EN] == 1" style="color:#71CB43;">{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span>
                <span v-if="scope.row[item.EN] == 2" style="color:#C80010;">{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span>
                <span v-if="scope.row[item.EN] == 3" style="color:#5884DE;">{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span>
                <!-- {{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}} -->
              </span>
              <span v-else>{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span>
            </div>
          </template>
          <!-- <template slot-scope="scope">{{scope.row[item.EN]}}</template> -->
          <!-- <template slot-scope="scope">{{scope.row[item.EN]}}</template> -->
        </el-table-column>
      </el-table>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 50, 100, 500]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="pagetotal"></el-pagination>
    </div>
  </div>
</template>

<script>
// import JBOcx from "<%=basePath%>/plug-in/ActiveX/ActiveX.cab##FileVersion=1,0,0,1"
// import csharpActiveX from "<%=basePath%>/plug-in/Activex/JXActivex.cab#version=1,0,2,0"
//引入组件
import {
  SAVE_CHECK_BOXS,
  GAIN_CHECK_BOXS,
} from '@/views/components/FLPage/fun/checkBoxFun'

import { derivedTbale } from '@/views/components/revenueFLpage'
//引入组件
import {
  SearchCForL,
  searchComponents,
  searchComponentsCss,
  buttonhurdle,
  rightButtons,
  dictionaries,
} from '@/views/components/FLPage'
// import {
//   addFlManualReading, //增加
//   deleteFlManualReading, //删除
//   searchFlManualReading, //分页查询
//   modifyFlManualReading, //修改
//   getFlManualReading, //根据ID获取
//   exprotXls,//导出xlsx数据
//   downTem, //导出下载模板
//   inputReadNum //录入读数
// } from "@/api/admin/flManualRead/index";
import {
  addFlManualReading, //增加
  deleteFlManualReading, //删除
  searchFlManualReading, //分页查询
  modifyFlManualReading, //修改
  getFlManualReading, //根据ID获取
  getDbfData, //导出凭证通
  getJXDbfData, //导出捷先
  getSCData, //导出三川
  postDbfData, //导入凭证通
  postJXDbfData, //导入捷先
  postSCData, //导入三川
  exprotXlsManual, //导出xlsx数据
  // downTem, //导出下载模板
  inputReadNum, //录入读数
} from '@/api/admin/flMechanicalReading/index'
export default {
  components: {
    SearchCForL,
    searchComponents,
    searchComponentsCss,
    buttonhurdle,
    rightButtons,
    dictionaries,
    derivedTbale,
  },
  data() {
    return {
      btnShow: false,
      moreBtnUp: false,
      moreBtnDown: true,
      numSearch: 0,
      but_pz: false,
      but_scxfpzt: false,
      but_jccbj: false,
      but_jcjxcbj: false,
      but_scxfjx: false,
      but_scxfsc: false,
      but_cb: false,
      but_export: false,

      //but_jc: false,
      loading: false,
      //   收缩框开关
      shrinkBoxOpenClose: false,
      //搜索框
      suoS: {},
      //瀑布数据
      //   搜索组件的数据
      searchData: [
        {
          EN: 'id',
          CN: '主键',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "sellingareaCode",
        //   CN: "营业厅",
        //   value: "",
        //   type: "input",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: true,
        //   addSign: true,
        //   tableSign: true,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'areaCode',
          CN: '片区',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          dictTable: {
            table: 'fl_area',
            id: 'id',
            name: 'name',
          },
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'watermeterNo',
          CN: '水表编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'hangbookCode',
          CN: '抄表手册',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          isMultiple: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          dictTable: {
            table: 'fl_book',
            id: 'id',
            name: 'name',
          },
          configurationSign: true,
        },
        {
          EN: 'readingUser',
          CN: '所属人员',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          dictTable: {
            table: 'base_user',
            id: 'id',
            name: 'name',
          },
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'watermeterAddress',
          CN: '安装位置',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'watermeterState',
          CN: '表状态',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'meter_status',
          configurationSign: true,
        },
        {
          EN: 'taskStartDate',
          CN: '任务开始日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'taskMonth',
          CN: '任务月份',
          value:
            new Date().getFullYear() +
            '-' +
            (new Date().getMonth() + 1 < 10
              ? '0' + (new Date().getMonth() + 1)
              : new Date().getMonth() + 1),
          type: 'dateMonth',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },

        {
          EN: 'cbStatus',
          // CN: "抄表状态 0未抄，1已抄，2已审核，3已结束",
          CN: '抄表状态',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'reading_status',
          configurationSign: true,
        },
        {
          EN: 'watermeterRange',
          CN: '水表量程',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'rang_value',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'readingValue',
          CN: '本期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^[0-9]*$',
          err: '只能输入数字',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'readingValue1',
          CN: '本期读数止',
          value: '',
          type: 'input',
          option: [],
          Exp: '^[0-9]*$',
          err: '只能输入数字',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'usingSum',
          CN: '合计用量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'usingSum1',
          CN: '合计用量止',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'thisCbDate',
          CN: '本次抄表日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastReadingValue',
          CN: '上期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastUsing',
          CN: '上期用量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastCbDate',
          CN: '上次抄表日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerName',
          CN: '客户名称',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerNo',
          CN: '客户编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'waterproperty',
          CN: '用水性质',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{0,20}$',
          err: '长度为3-20的所有字符!',
          dictTable: {
            table: 'fl_water_use_property',
            id: 'id',
            name: 'name',
          },
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: true,
          skipSign: true,
        },
        {
          EN: 'customerTel',
          CN: '联系电话',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },

        {
          EN: 'bookName',
          CN: '抄表手册',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'bookNo',
          CN: '手册编码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'queueNo',
          CN: '序号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'xq',
          CN: '小区',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'loudongId',
          CN: '楼栋号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'unitId',
          CN: '单元号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'roomNumber',
          CN: '门牌号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },

        {
          EN: 'jzqId',
          CN: '集中器编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'machineType',
          CN: '抄表机类型',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'read_meter_factory',
          configurationSign: true,
        },
        {
          EN: 'cjqId',
          CN: '采集器编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'moduleAddr',
          CN: '模块地址',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'dma',
          CN: 'dma分区',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },

        {
          EN: 'watMeterAddrCode',
          CN: '表计地址码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },

        {
          EN: 'jingDu',
          CN: '经度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'weiDu',
          CN: '纬度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'gangYinHao',
          CN: '钢印号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'readLongitude',
          CN: '抄表人定位经度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'readLatitude',
          CN: '抄表人定位纬度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterEnv',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterLocation',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterNum',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'taskId',
          CN: '所属任务id',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'type',
          CN: '水表类型 1手动抄表，5抄表机抄表',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'channelNumber',
          CN: '通道号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'jxCbjProtocol',
          CN: '捷先抄表机协议',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
      ],
      //添加弹窗的数据模型
      diaDataAdd: {
        yyqName: '',
        pqName: '',
        pqNum: '',
        BH: '',
      },
      //删除----Start----------------------------------------
      deleteDataList: [],
      //删除----End----------------------------------------

      //查看----Start----------------------------------------
      //查看的弹窗控制器
      DialogVisibleExamine: false,
      //查看的数据
      examineData: {},
      //查看----End----------------------------------------

      //表格数据
      //后端传来的数据
      dataAttribute: [],
      //表格选中
      multipleSelection: [],
      //分页
      currentPage: 1, //当前页
      pagesize: 10, //每页条数
      pagetotal: 0, //总条数
      // 导入的请求地址
      importUrl: `/api/cb/flManualReading/importXls`,
      modelType: 'table',
      optionsZi: [],
      searchOptionTable: [],
      focusIndex: -1,
      currentLineIndex: -1,
      inputOpenOrClose: false,
      // 当前选中的单元格  行的id
      currentId: -1,
      // 插件检测
      dbf_path: '',
      // objectjiexian:''
    }
  },
  computed: {
    // 字典
    optionDatas() {
      return function (arr, val) {
        // console.log(arr,val,666666633333333);

        // console.log(arr[val],'why');
        if (arr) {
          // console.log(arr[val], val)
        }
        if (arr) {
          for (let i = 0; i < arr.length; i++) {
            if (arr[i].value === val) {
              // console.log(arr[i].label)
              return arr[i].label
            }
          }
        }
      }
    },
    customMethod() {
      return function (item) {
        return 'custom'
        // if (item.EN === 'readnum') {
        //   return 'custom'
        // }
        // else{
        //   return false
        // }
      }
    },
  },
  directives: {
    focus: {
      // 指令自定义   自动获取焦点
      inserted: function (el) {
        console.log(el.children[0].focus())
        // el.children[0].focus();
      },
    },
  },

  async created() {
    this.but_pz = this.$store.state.user.elements['flMechanicalReading:but_pz']
    this.but_scxfpzt =
      this.$store.state.user.elements['flMechanicalReading:but_scxfpzt']
    this.but_jccbj =
      this.$store.state.user.elements['flMechanicalReading:but_jccbj']
    this.but_jcjxcbj =
      this.$store.state.user.elements['flMechanicalReading:but_jcjxcbj']
    this.but_scxfjx =
      this.$store.state.user.elements['flMechanicalReading:but_scxfjx']
    this.but_scxfsc =
      this.$store.state.user.elements['flMechanicalReading:but_scxfsc']
    this.but_dqscxf =
      this.$store.state.user.elements['flMechanicalReading:but_dqscxf']
    this.but_export =
      this.$store.state.user.elements['flMechanicalReading:but_export']
    this.but_cb = this.$store.state.user.elements['flMechanicalReading:but_cb']

    if (this.but_cb) {
      this.but_cb = true
    } else {
      this.but_cb = false
    }
    this.loading = true
    this.getSSearchNum()

    //获取保存的’配置‘
    //1.ajax

    let userId = this.$store.state.user.id
    let routerName = this.$route.path
    console.log(userId)
    let peizhiData = await GAIN_CHECK_BOXS(userId, routerName)
    console.log(peizhiData, 55666)

    //2.判断数据库里面是否有 以前存过的配置信息
    if (peizhiData['ATE'] == 'ERROR') {
      //这表示没获取到，这种情况用原来的searchData
    } else {
      //这表示获取到了‘配置’，所以使用新的数值
      //3.解析(序列化)
      if (peizhiData.stringData != '') {
        this.searchData = JSON.parse(peizhiData.stringData)
      }
    }

    this.forData(this.currentPage, this.pagesize, this.suoS)
  },
  mounted() {
    let btnLength = document
      .getElementById('btnGroups')
      .querySelectorAll('button').length
    if (btnLength > 5) {
      this.btnShow = true
    }
  },
  methods: {
    // 多选手册，需要转化为string
    reverseSuoS(suoS) {
      for (let item in suoS) {
        if (Array.isArray(suoS[item])) {
          suoS[item] = suoS[item].join(',')
        }
      }
      return suoS
    },
    btnMore() {
      this.moreBtnDown = !this.moreBtnDown
      this.moreBtnUp = !this.moreBtnUp
    },
    // 搜索框
    getSSearchNum() {
      let searchData = this.searchData
      let num = 0
      for (let i = 0; i < searchData.length; i++) {
        const element = searchData[i]
        if (element.searchSign) {
          num += 1
        } else {
          num = num
        }
      }
      this.numSearch = num
    },
    //排序
    sortChangeTable(obj) {
      // { column, prop, order }
      // 上升
      console.log(obj)
      let prop = obj.prop
      // 排序  需求  将驼峰形式的字段 改为 下划线形式的字段
      let abc = prop.replace(/([A-Z])/g, '_$1').toLowerCase()
      console.log(abc, 999)
      if (obj.order === 'ascending') {
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = obj.order
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
      } else if (obj.order === 'descending') {
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = obj.order
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
        // 下降
      } else {
        // 正常
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = ''
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
        // this.forData(this.currentPage, this.pagesize, this.suoS); //刷新列表
      }
    },
    // 序号
    indexMethod(index) {
      var currentPage = this.currentPage
      var pagesize = this.pagesize
      this.$nextTick(function () {
        currentPage = this.currentPage
        pagesize = this.pagesize
      })
      // console.log(currentPage,pagesize,'996');
      // console.log(currentPage*pagesize+index - 9);
      return currentPage * pagesize - pagesize + 1 + index
    },
    // 检测插件
    CheckActiveX() {
      try {
        var state = JBOcx.Init()
        this.$message({
          message: '插件可用!',
          type: 'success',
        })
        // layer.msg("插件可用!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
      } catch (e) {
        this.$alert(
          "插件安装失败!<br/>可尝试手动安装：<a style='color:#4287cf' href='static/ActiveX.cab'>下载插件</a>，解压后打开FLActiveXDBF.msi",
          '提示',
          {
            dangerouslyUseHTMLString: true,
          }
        )
        // this.$message({
        //   message:'插件安装失败!',
        //   type:'warning'
        // })
        // layer.msg("插件安装失败!<br/>可尝试手动安装：<a style='color:#4287cf' href='<%=basePath%>/plug-in/ActiveX/ActiveX.cab'>下载插件</a>，解压后打开FLActiveXDBF.msi",{title:'提示信息',offset: 'rb',area: ['300px','150px'],icon: 1,anim: 30});
      }
    },
    // 检测抄表机
    // CheckCbj(title, url, gname){
    CheckCbj(title) {
      if (title == '检测抄表机') {
        try {
          var state = JBOcx.cbj.hs_state(5)
          if (state == 119) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
          } else {
            this.$message({
              message: '检测到抄表机!',
              type: 'success',
            })
          }
        } catch (e) {
          this.$message({
            message: '插件不可用，请点击检测插件!',
            type: 'warning',
          })
          // layer.msg("插件不可用，请点击检测插件!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
        }
      }
      if (title == '检测捷先抄表机') {
        try {
          let object = document.getElementById('csharpActiveX')
          let ss = object && object.CheckJX()
          if (ss != 0) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
          } else {
            this.$message({
              message: '检测到抄表机!',
              type: 'success',
            })
          }
        } catch (error) {
          this.$message({
            message: '未检测到抄表机!',
            type: 'warning',
          })
        }
      }
    },
    // , url, gname
    // 下发抄表档案到抄表机
    DownLoadFile(title) {
      if (title == '下发平政通抄表档案') {
        try {
          //检测抄表机已连接
          //var state = JBOcx.getcon(5);
          var state = JBOcx.cbj.hs_state(5)
          if (state == 119) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
            return
          }
        } catch (e) {
          this.$message({
            message: '插件不可用，请点击检测插件!',
            type: 'warning',
          })
          return
        }

        this.getDbfDataDom(this.reverseSuoS(this.suoS))
      }
      if (title == '下发捷先抄表档案') {
        //检测抄表机已连接
        try {
          let object = document.getElementById('csharpActiveX')
          let ss = object && object.CheckJX()
          if (!['0', 0].includes(ss)) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
            // layer.msg("未检测到抄表机!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
            return
          }

          this.getJXDbfDataDom(this.reverseSuoS(this.suoS), object)
        } catch (error) {
          this.$message({
            message: '未检测到抄表机!',
            type: 'warning',
          })
        }
      }
      if (title == '下发三川抄表档案') {
        try {
          //检测抄表机已连接
          //var state = JBOcx.getcon(5);
          var state = JBOcx.cbj.hs_state(5)
          if (state == 119) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
            // layer.msg("未检测到抄表机!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
            return
          }
        } catch (e) {
          this.$message({
            message: '插件不可用，请点击检测插件!',
            type: 'warning',
          })
          // layer.msg("插件不可用，请点击检测插件!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
          return
        }
        this.getSCDataDom(this.reverseSuoS(this.suoS))
      }
    },
    // 上传抄表档案到抄表机
    async UploadFile(title) {
      var batchId = new Date().getTime()
      if (title == '上传平政通抄表档案') {
        try {
          var state = JBOcx.cbj.hs_state(5)
          if (state == 119) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
            // layer.msg("未检测到抄表机!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
            return
          }
        } catch (e) {
          this.$message({
            message: '插件不可用，请点击检测插件!',
            type: 'warning',
          })
          // layer.msg("插件不可用，请点击检测插件!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
          return
        }
        // ajaxLoading("正在上传抄表数据...");
        var s = JBOcx.cbj.uptofile(0, 'hwdata.dbf', 'D:/temp/hwdata.dbf')
        if (s == 1) {
          //读取dbf文件，返回JSON字符串数据
          var d = JBOcx.readDbf('hwdata.dbf')
          //把数据分割多份上传
          // var dd = d.parseJSON()
          // var c = JSON.stringify(d)
          var dd = JSON.parse(d)
          console.log(d, 333)

          // var dd = d
          console.log(dd, 555)
          console.log(typeof dd)

          // console.log(dd.data.length);
          var rowList = this.group(dd.data, 2000)
          let dataListData = []
          for (var i = 0; i < rowList.length; i++) {
            //请求未抄表数据,
            var PZTdata = JSON.stringify(rowList[i])
            console.log(PZTdata, typeof PZTdata, 55225)
            var abc = JSON.parse(PZTdata)
            console.log(abc, typeof abc, 5523325)

            // let data = this.postDbfDataDom()
            console.log(PZTdata, batchId)
            var def = batchId.toString()
            console.log(batchId, typeof batchId, def, typeof def, 333)

            let param = {
              dbfData: abc,
              batchId: def,
            }
            let dataObjData = await this.postDbfDataDom(param)
            dataListData.push(dataObjData)
          }
          console.log(dataListData, '所有请求的返回值 组成的数组')
          var kaiguanData = true
          var kaiguanMessage = ''
          for (let i = 0; i < dataListData.length; i++) {
            const element = dataListData[i]
            if (element.flag == false) {
              kaiguanData = false
              this.$message({
                message: element.message,
                type: 'warning',
              })
              return
            } else {
              kaiguanMessage = element.message
            }
          }
          if (kaiguanData) {
            this.$message({
              message: kaiguanMessage,
              type: 'success',
            })
          }
          // dataListData
        } else {
          this.$message({
            message: '获取档案失败，请重新获取！',
            type: 'warning',
          })
        }
      }
      if (title == '上传捷先抄表档案') {
        var object = document.getElementById('csharpActiveX')
        var ss = object.CheckJX()
        if (ss != 0) {
          this.$message({
            message: '未检测到抄表机!',
            type: 'warning',
          })
          // layer.msg("未检测到抄表机!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
          return
        }
        // ajaxLoading("正在上传抄表数据...");
        var ss = object.UPDataFile('METERINFO.DBF')
        var a = JSON.parse(ss)
        // var a = jQuery.parseJSON(ss);
        var result = a.result //ss.substring(11,12);
        if (result == 0) {
          //把数据分割多份上传
          var rowList = this.group(a.data, 2000)
          let dataListJXData = []
          for (var i = 0; i < rowList.length; i++) {
            var JXdata = JSON.stringify(rowList[i]) //ss.substring(22,ss.length-2);
            console.log(
              'total：' +
                a.data.length +
                ',' +
                rowList[i].length +
                ',' +
                result +
                '\n' +
                JXdata
            )
            var abc = JSON.parse(JXdata)
            console.log(abc, typeof abc, 5523325)
            //转换  对象中的
            for (let i = 0; i < abc.length; i++) {
              let element = abc[i]
              console.log(element, 111)
              for (const key in element) {
                console.log(element[key], typeof element[key], 222)
                element[key] = element[key].toString()
                console.log(element[key], typeof element[key], 333)
              }
            }
            // let data = this.postDbfDataDom()
            console.log(JXdata, batchId)
            var def = batchId.toString()
            console.log(batchId, typeof batchId, def, typeof def, 333)

            let param = {
              dbfData: abc,
              batchId: def,
            }
            let dataObjJXData = await this.postJXDbfDataDom(param)
            dataListJXData.push(dataObjJXData)
          }
          console.log(dataListJXData, '所有请求的返回值 组成的数组')
          var kaiguanData = true
          var kaiguanMessage = ''
          for (let i = 0; i < dataListJXData.length; i++) {
            const element = dataListJXData[i]
            if (element.flag == false) {
              kaiguanData = false
              this.$message({
                message: element.message,
                type: 'warning',
              })
              return
            } else {
              kaiguanMessage = element.message
            }
          }
          if (kaiguanData) {
            this.$message({
              message: kaiguanMessage,
              type: 'success',
            })
          }
        } else {
          this.$message({
            message: '获取档案失败，请重新获取！',
            type: 'warning',
          })
        }
      }
      if (title == '上传三川抄表档案') {
        try {
          var state = JBOcx.cbj.hs_state(5)
          if (state == 119) {
            this.$message({
              message: '未检测到抄表机!',
              type: 'warning',
            })
            // layer.msg("未检测到抄表机!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
            return
          }
        } catch (e) {
          this.$message({
            message: '插件不可用，请点击检测插件!',
            type: 'warning',
          })
          // layer.msg("插件不可用，请点击检测插件!",{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
          return
        }
        var s = JBOcx.cbj.uptofile(0, '住户.dbf', 'D:/temp/住户.dbf')
        if (s == 1) {
          //读取dbf文件，返回JSON字符串数据
          var d = JBOcx.readDbf('住户.dbf')
          console.log(d, 663)

          //把数据分割多份上传
          var dd = JSON.parse(d)
          // var dd = jQuery.parseJSON(d);
          console.log(dd.data.length)
          var rowList = this.group(dd.data, 2000)
          let dataSCListData = []
          for (var i = 0; i < rowList.length; i++) {
            //请求未抄表数据,
            var PZTdata = JSON.stringify(rowList[i])
            var abc = JSON.parse(PZTdata)
            console.log(abc, typeof abc, 5523325)
            //转换  对象中的-----
            for (let i = 0; i < abc.length; i++) {
              let element = abc[i]
              console.log(element, 111)
              for (const key in element) {
                console.log(element[key], typeof element[key], 222)
                element[key] = element[key].toString()
                console.log(element[key], typeof element[key], 333)
              }
            }
            // -------

            // let data = this.postDbfDataDom()
            console.log(PZTdata, batchId)
            var def = batchId.toString()
            console.log(batchId, typeof batchId, def, typeof def, 333)

            let param = {
              dbfData: abc,
              batchId: def,
            }
            let dataSCObjData = this.postSCDataDom(param)
            dataSCListData.push(dataSCObjData)
          }
          console.log(dataSCListData, '所有请求的返回值 组成的数组')
          var kaiguanData = true
          var kaiguanMessage = ''
          for (let i = 0; i < dataSCListData.length; i++) {
            const element = dataSCListData[i]
            if (element.flag == false) {
              kaiguanData = false
              this.$message({
                message: element.message,
                type: 'warning',
              })
              return
            } else {
              kaiguanMessage = element.message
            }
          }
          if (kaiguanData) {
            this.$message({
              message: kaiguanMessage,
              type: 'success',
            })
          }
        } else {
          this.$message({
            message: '获取档案失败，请重新获取！',
            type: 'warning',
          })
        }
      }
    },
    // 数据处理
    group(array, subGroupLength) {
      var index = 0
      var newArray = []
      while (index < array.length) {
        newArray.push(array.slice(index, (index += subGroupLength)))
      }
      return newArray
    },
    // 导出凭证通
    async getDbfDataDom(suoS) {
      const result = await getDbfData(suoS)
      if (result.flag) {
        console.log(result, 963)

        var jsondata = result.data
        console.log(jsondata)
        var data = eval(jsondata)
        //返回未抄表的JSON数据
        console.log(data)
        var a = JSON.stringify(data)
        // var b = {"data":[{"sfbh":"123","yhm":"123"}]}
        console.log(a, typeof a, 666)
        // let bcd = "{\"data\":[{ \"sccj\": 27, \"bccj\": \"0\",\"cjqbh\": \"00030538190101\", \"bbh\": \"00201810240288\", \"sfbh\": \"1\", \"yhdz\": \"文轩华庭1#楼1单元3楼302（上表）\", \"bzt\": \"未抄表\", \"yhm\": \"张惠芳\"}, { \"sccj\": 23, \"bccj\": \"0\",\"cjqbh\": \"00030538190101\", \"bbh\": \"00201810240714\", \"sfbh\": \"2\", \"yhdz\": \"文轩华庭1#楼1单元3楼301（下表）\", \"bzt\": \"未抄表\", \"yhm\": \"毛娟娟\"}]}";
        // let def = {"data":[{"sfbh":"123","yhm":"123"}]}
        //生成DBF文件,参数说明pram1:hwdata.dbf,pram2:1为千宝通188协议，pram3:JSON数据（未抄表的）{"data":[{"sfbh":"123","yhm":"123"}]}
        var dbfpath = JBOcx.createDbf('hwdata.dbf', 1, a)
        // debugger
        console.log(dbfpath)
        //将dbf文件传输到抄表机
        //var st = JBOcx.download(0, dbfpath);
        var st = JBOcx.cbj.downfile(0, dbfpath)
        // debugger
        if (st == 1) {
          this.$message({
            message: result.message,
            type: 'success',
          })
        } else {
          this.$message({
            message: '下发档案失败，请重新下发！',
            type: 'warning',
          })
        }
      } else {
        this.$message({
          message: result.message,
          type: 'warning',
        })
      }
    },

    // 导出捷先
    async getJXDbfDataDom(suoS, object) {
      const result = await getJXDbfData(suoS)
      if (result.flag) {
        var jsondata = result.data
        console.log(jsondata, 333)
        var d = eval(jsondata)
        //返回未抄表的JSON数据
        var a = JSON.stringify(d.data)
        console.log(a, 663)
        // let object = this.objectjiexian
        // var datajson = "[{\"AREA_NO\":\"3054\",\"AREA_NAME\":\"163（集抄表本）\",\"COLLECT_NO\":\"empty\",\"METER_NO\":\"empty\",\"USER_NO\":\"10018287\",\"USERNAME\":\"泰安市文轩物业管理有限公司\",\"TELPHONE\":\"empty\",\"USER_ADDR\":\"西山路文轩华庭3#楼南，换热站\",\"FACTORY_NO\":\"1\",\"FIRST_READ\":\"0\",\"FIRST_DATE\":\"2019-08-28\",\"FIRST_TIME\":\"10:29:40\",\"SECONDREAD\":\"0\",\"SECONDDATE\":\"2019-08-28\",\"SECONDTIME\":\"10:29:40\",\"THIRD_READ\":\"0\",\"THIRD_DATE\":\"2019-08-28\",\"THIRD_TIME\":\"10:29:40\",\"CURR_READ\":\"0\",\"CURR_DATE\":\"2019-08-28\",\"CURR_TIME\":\"10:29:40\",\"METER_BIT\":\"4\",\"METERSTATE\":\"0\",\"USEAGE\":\"0\"}]";
        var st = object.DownDataFile(a, 'meterinfo.dbf')
        console.log(st, 33222)

        if (st == 0) {
          this.$message({
            message: result.message,
            type: 'success',
          })
          // ajaxLoadEnd();
          // layer.msg(result.msg, {title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
        } else {
          this.$message({
            message: '下发档案失败，请重新下发！',
            type: 'warning',
          })
          // ajaxLoadEnd();
          // layer.msg("下发档案失败，请重新下发！"+st,{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
        }
      } else {
        this.$message({
          message: result.message,
          type: 'warning',
        })
      }
    },
    // 导出三川
    async getSCDataDom(suoS) {
      const result = await getSCData(suoS)

      if (result.flag) {
        var jsondata = result.data
        console.log(jsondata)
        var data = eval(jsondata)
        //返回未抄表的JSON数据
        var a = JSON.stringify(data)
        console.log(a)
        //生成DBF文件,参数说明pram1:住户.dbf,pram2:1在此处默认1,pram3:JSON数据（未抄表的）{"data":[{"sfbh":"123","yhm":"123"}]}
        var dbfpath = JBOcx.createDbf('住户.dbf', 1, a)
        console.log(dbfpath)
        //将dbf文件传输到抄表机
        //var st = JBOcx.download(0, dbfpath);
        var st = JBOcx.cbj.downfile(0, dbfpath)
        if (st == 1) {
          this.$message({
            message: result.message,
            type: 'success',
          })
          // ajaxLoadEnd();
          // layer.msg(result.msg, {title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
        } else {
          this.$message({
            message: '下发档案失败，请重新下发！',
            type: 'warning',
          })
          // ajaxLoadEnd();
          // layer.msg("下发档案失败，请重新下发！"+st,{title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
        }
      } else {
        this.$message({
          message: result.message,
          type: 'warning',
        })
        // ajaxLoadEnd();
        // layer.msg(result.msg , {title:'提示信息',offset: 'rb',area: ['250px','120px'],icon: 1,anim: 2});
      }
    },
    // 导入凭证通
    async postDbfDataDom(param) {
      const data = await postDbfData(param)
      return data
      // try {
      //     if (data.flag) {
      //         this.$message({
      //             message: data.message,
      //             type: "success"
      //         });
      //         // 刷新页面
      //         this.forData(this.currentPage, this.pagesize, this.suoS);
      //     } else {
      //         this.$message({
      //             message: data.message,
      //             type: "warning"
      //         });
      //     }
      // } catch (error) {
      //     this.$message({
      //         message: "上传档案失败！",
      //         type: "warning"
      //     });
      // }
    },
    // 导入捷先
    async postJXDbfDataDom(param) {
      const data = await postJXDbfData(param)
      return data
      // try {
      //     if (data.flag) {
      //         this.$message({
      //             message: data.message,
      //             type: "success"
      //         });
      //         // 刷新页面
      //         this.forData(this.currentPage, this.pagesize, this.suoS);
      //     } else {
      //         this.$message({
      //             message: data.message,
      //             type: "warning"
      //         });
      //     }
      // } catch (error) {
      //     this.$message({
      //         message: "上传档案失败！",
      //         type: "warning"
      //     });
      // }
    },
    // 导入三川
    async postSCDataDom(param) {
      const data = await postSCData(param)
      try {
        if (data.flag) {
          this.$message({
            message: data.message,
            type: 'success',
          })
          // 刷新页面
          this.forData(this.currentPage, this.pagesize, this.suoS)
        } else {
          this.$message({
            message: data.message,
            type: 'warning',
          })
        }
      } catch (error) {
        this.$message({
          message: '上传档案失败！',
          type: 'warning',
        })
      }
    },
    handleSuccessImport(newValue) {
      console.log(newValue, 8888)

      if (newValue == '导入成功') {
        console.log(newValue, 9999)

        this.forData(this.currentPage, this.pagesize, this.suoS)
      }
    },
    //配置的子组件通知
    async goFatherComponent(OverData) {
      //1.修改父组件的视图***************
      this.searchData = JSON.parse(JSON.stringify(OverData))
      //2.保存’配置‘的更改
      let obj = {}
      //三个参数都是string类型***********
      obj['userId'] = this.$store.state.user.id //1
      obj['routerName'] = this.$route.path ///jiChuZiLiao/flBook
      obj['stringData'] = JSON.stringify(OverData) //相当于this.searchData转成了字符串格式    [{"EN":"id","CN":"主键","value":""...
      //封装好的发请求方法*****************
      let save_check_boxs = await SAVE_CHECK_BOXS(obj)
    },
    // 配置
    configuration(msg) {
      if (msg == '配置') {
        console.log(msg)
      }
    },
    // 重置
    emptySearch(msg) {
      if (msg == '重置') {
        this.currentPage = 1
        this.suoS = {}
        this.forData(this.currentPage, this.pagesize, this.suoS)
      }
    },
    clickFocus(row, column, cell, event) {
      // console.log(cell,event,89889);
      console.log(row, column, cell, event, 89889)
      // 当前选中的id
      this.currentId = row.$index
    },
    // 改变抄表状态
    async changeStatus(row, readNum) {
      const res = await inputReadNum(row, readNum)
      if (res.code === 20001) {
        this.$message({
          message: res.message,
          type: 'warning',
        })
        return false
      }
      return true
      console.log(res)
    },
    async inputBlur(index, readNum, id, row) {
      this.toWatermeterRangeLabel(row.watermeterRange)
      let watermeterRangeLabel = this.watermeterRangeLabel
      console.log('比较数据', readNum, watermeterRangeLabel)
      if (index === this.currentId) this.currentId = -1
      console.log(index, readNum, 888, id)
      // console.log(this.focusIndex == index,555);
      // this.focusIndex == index
      index = index + 1
      let result = ''
      if (isNaN(readNum)) {
        readNum = ''
        // for (let i = 0; i < this.dataAttribute.length; i++) {
        //   const element = this.dataAttribute[i];
        //   this.dataAttribute[i][]

        // }
        this.$message({
          message: '请输入数字类型',
          type: 'warning',
        })
      } else if (readNum > watermeterRangeLabel) {
        this.$message({
          message: '读数不能超过水表量程',
          type: 'warning',
        })
      } else {
        // ---
        if (readNum) {
          result = await this.changeStatus(id, readNum)
        }
      }
      // 刷新页面
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    openResult() {
      this.$alert('抄录为空', '提示', {
        confirmButtonText: '确定',
        callback: (action) => {
          this.$message({
            type: 'info',
            message: '请继续抄录',
          })
        },
      })
    },
    toWatermeterRangeLabel(value) {
      let optionsZi = this.optionsZi
      let arr = optionsZi['watermeterRange']
      for (let i = 0; i < arr.length; i++) {
        const element = arr[i]
        if (arr[i].value === value) {
          this.watermeterRangeLabel = arr[i].label
        }
      }
    },
    async inputFoucs(index, readNum, id, row) {
      console.log(index, readNum, 888, id, isNaN(readNum))
      this.toWatermeterRangeLabel(row.watermeterRange)
      let watermeterRangeLabel = this.watermeterRangeLabel
      console.log('比较数据', readNum, watermeterRangeLabel)
      // 获取水表量程
      // row.watermeterRange
      // console.log(this.focusIndex == index,555);
      // this.focusIndex == index
      index = index + 1
      let result = ''
      let readNumq = Number(readNum)
      let watermeterRangeLabelq = Number(watermeterRangeLabel)
      console.log('比较数据', readNumq, watermeterRangeLabelq)
      // ---
      // console.log(aa,996,aa===NaN,typeof(aa));
      if (isNaN(readNum)) {
        this.$message({
          message: '请输入数字类型',
          type: 'warning',
        })
      } else if (readNumq > watermeterRangeLabelq) {
        this.$message({
          message: '读数不能超过水表量程',
          type: 'warning',
        })
      } else {
        console.log(2)
        //*****9999 */
        if (readNum) {
          result = await this.changeStatus(id, readNum)
        } else {
          this.openResult()
          return false
        }

        // 刷新页面
        this.forData(this.currentPage, this.pagesize, this.suoS)
        if (this.suoS.cbStatus === '') {
          if (!result) return false
          if (!readNum) {
            // this.openResult()
            // return false
          }
          // 刷新页面
          //this.forData(this.currentPage, this.pagesize, this.suoS);
          this.currentId = index > this.pagesize ? -1 : index
          console.log(this.currentId, '下一个选择框的下标')

          this.focusIndex = index
          // console.log(this.focusIndex,'??');
          // 传的参数   当前的行数    此单元格的值

          // this.forData(this.currentPage, this.pagesize, this.suoS);
          // 问题：currentId已经改变   但是下一个input不显示
        }
      }
    },
    openResult() {
      this.$alert('抄录为空', '提示', {
        confirmButtonText: '确定',
        callback: (action) => {
          this.$message({
            type: 'info',
            message: '请继续抄录',
          })
        },
      })
    },
    // 每一行的index
    okl(index, row) {
      console.log(index, row, 666)

      // focusIndex
      // this.currentLineIndex = index
      this.currentId = index
    },
    // 字典组件回调
    dictionariesCallBack([a = {}, b = {}]) {
      // 正常字典
      this.optionsZi = a
      // 跨表字典
      this.searchOptionTable = b
      // console.log(a,b,66688);
      this.currentPage = 1
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    //搜索
    sunS_F() {
      this.currentPage = 1
      this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
    },
    //查询组件回调
    searchCallBack(newData) {
      console.log(newData)
      //组装数据（newData是个数组）

      let obj = {}
      for (let i = 0; i < newData.length; i++) {
        obj[newData[i].EN] = newData[i].value
      }
      console.log(obj)
      this.suoS = obj
    },
    //渲染数据初始
    forData(page, size, searchData) {
      this.loading = true
      for (let item in searchData) {
        if (Array.isArray(searchData[item])) {
          searchData[item] = searchData[item].join(',')
        }
      }
      searchFlManualReading(page, size, searchData).then((response) => {
        this.pagetotal = response.data.total
        this.dataAttribute = response.data.list
        this.loading = false
      })
    },
    //表格选中事件
    handleSelectionChange(val) {
      this.multipleSelection = val
      //传递删除的参数
      this.deleteDataList = val
    },

    //分页
    handleSizeChange(val) {
      console.log('每页 ' + val + ' 条')
      this.pagesize = val
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    handleCurrentChange(val) {
      console.log('当前页: ' + val)
      this.currentPage = val
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    // 下载模板请求
    exprotXlsx: exprotXlsManual,
    // downloadFile: downTem
  },
  // watch:{
  //   currentId:{

  //   }
  // }
}
</script>

<style scoped src="@/styles/allCssP.css"></style>
<style lang="scss" scoped>
.flManualReading {
  .importX {
    margin-left: 10px;
  }
  .btn-groups {
    flex-shrink: 0;
    flex: 1;
    flex-basis: 760px;
    max-width: 760px;
    display: flex;
    justify-content: space-between;
  }
  .moreBtnClassDefault {
    overflow: hidden;
    height: 30px;
    button {
      margin-bottom: 15px;
    }
  }
  .moreBtnClass {
    overflow: auto;
    height: auto;
  }
  .btnMoreClass {
    cursor: pointer;
    i {
      color: #0b9ac3;
      font-weight: 600;
    }
  }
  .shrinkBox {
    text-align: center;
    font-weight: 700;
    font-size: 20px;
    height: 25px;
    // border-bottom:1px solid #E6E6E6;
  }

  .out {
    // 解决table表格线错位
    /deep/ .el-table--mini {
      .gutter {
        display: table-cell !important;
      }

      .el-checkbox__inner {
        width: 12px;
        height: 12px;
      }

      // 改变表头的高度  改为45px
      /deep/.el-table__header-wrapper {
        .el-table__header {
          .has-gutter {
            tr {
              th {
                padding: 5px 0 !important;
                height: 34px;
                line-height: 34px;
              }
            }
          }
        }
      }

      // 表头操作固定定位
      /deep/.el-table__fixed-right {
        .el-table__header {
          thead {
            tr {
              th {
                padding: 5px 0 !important;
                height: 34px;
                line-height: 34px;
              }
            }
          }
        }
      }

      .el-table__body-wrapper {
        .el-table__body {
          tbody {
            .el-table__row {
              height: 42px !important;
            }
          }
        }
      }

      .el-input__inner {
        border: 0;
      }
    }

    .right_row {
      padding: 25px 30px;
      margin-top: -10px;
      margin-bottom: -10px;

      .rightButtons {
        position: absolute;
        padding: 0px !important;
        right: 30px;
      }

      .buttonhurdle {
        padding: 0px !important;
      }
    }
    .el-pagination {
      text-align: left;
      margin-top: 20px;
    }
  }
}
</style>
